// 神话世界·西游记·版本４．５０
/* <SecCrypt CPL V3R05> */
 
//inventory.c

#include <ansi.h>

inherit F_CLEAN_UP;

int main(object me, string arg)
{
   int i;
   object *inv, ob;

   if( wizardp(me) && arg ) {
     ob = find_player(arg);
     if( !ob ) ob = find_living(arg);
     if( !ob ) ob = present(arg, environment(me));
   }

   if( !ob ) ob = me;

   inv = all_inventory(ob);
   if( !sizeof(inv) ) {
     write((ob==me)? "目前你身上没有任何东西。\n"
        : ob->name() + "身上没有携带任何东西。\n");
     return 1;
   }
   i=sizeof(inv);
   printf("%s 拥有%d件东西(负重 %d%%)：\n",
		(ob==me)? "你": ob->name(),
        i,
		(int)ob->query_encumbrance() * 100 / (int)ob->query_max_encumbrance());
    printf(NOR CYN"================"HIM"个人负重"CYN"===================\n"NOR);
	printf(
		implode(map_array(inv, "inventory_desc", this_object()), "\n") );
    printf("\n");
    printf(NOR CYN"================"HIM"西行漫纪"CYN"===================\n"NOR);

   return 1;
}

string inventory_desc(object ob)
{
   return sprintf("%s%s",
     ob->query("equipped")? HIC "□" NOR:"  ",
     ob->short()
   );
}

int help (object me)
{
        write(@HELP
指令格式: inventory
 
可列出你目前身上所携带的所有物品。
 
注 : 此指令可以 " i " 代替。
 
HELP
);
        return 1;
}
